package com.ruoyi.system.service.impl;

import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.entity.SysStudent;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.bean.BeanValidators;
import com.ruoyi.common.utils.security.Md5Utils;
import com.ruoyi.common.utils.spring.SpringUtils;
import com.ruoyi.system.domain.SysPost;
import com.ruoyi.system.domain.SysUserPost;
import com.ruoyi.system.domain.SysUserRole;
import com.ruoyi.system.mapper.SysStudentMapper;
import com.ruoyi.system.service.ISysStudentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * @author admin
 */
@Service
public class SysStudentServiceImpl implements ISysStudentService {

    private static final Logger log = LoggerFactory.getLogger(SysStudentServiceImpl.class);

    @Autowired
    private SysStudentMapper studentMapper;
    /**
     * 根据条件分页查询用户列表
     *
     * @param user 用户信息
     * @return 用户信息集合信息
     */
    @Override
    @DataScope(deptAlias = "d", userAlias = "u")
    public List<SysStudent> selectStudentList(SysStudent user)
    {
        return studentMapper.selectStudentList(user);
    }

    @Override
    public SysStudent selectStudentById(Long studentId) {
        return studentMapper.selectStudentById(studentId);
    }


    @Override
    public int deleteStudentById(Long studentId) {
        return studentMapper.deleteStudentById(studentId);
    }

    @Override
    public int deleteStudentByIds(String ids) {
        Long[] userIds = Convert.toLongArray(ids);

        return studentMapper.deleteStudentByIds(userIds);
    }

    @Override
    public int insertStudent(SysStudent student) {
        return studentMapper.insertStudent(student);
    }

    @Override
    public int updateStudent(SysStudent student) {
        return studentMapper.updateStudent(student);
    }


}
